package com.twu.biblioteca;

import com.twu.biblioteca.menu.Menu;
import com.twu.biblioteca.menu.MenuFormatter;
import com.twu.biblioteca.menu.SelectionParser;
import com.twu.biblioteca.model.Book;
import com.twu.biblioteca.model.BookList;

import java.io.PrintStream;
import java.util.Arrays;
import java.util.List;

public class BibliotecaApp {

    public static void main(String[] args) {
        populateBookList();

        printWelcome(System.out);

        while(true){
            Menu.displayMenu(new MenuFormatter(System.out));
            Menu.select(new SelectionParser(System.in), System.out);
        }
    }

    public static void printWelcome(PrintStream printStream){
        printStream.println("Welcome to the Bangalore Public Library");
        printStream.println("=======================================");
        printStream.println();
    }

    private static void populateBookList(){
        List<Book> listOfBooks = Arrays.asList(new Book("Book 1", "Author 1"), new Book("Book 2", "Author 2"));

        BookList bookList = BookList.getInstance();
        bookList.addList(listOfBooks);
    }
}
